\documentclass{article}

\begin{document}
\begin{tabular}{|c|c|c|c|c|}
\hline
A & 1 & \multicolumn{2}{c|}{2} & \\ \hline
B & \multicolumn{2}{c|}{2} & 1 & \\
\hline
a&b&c&d&e\\
\hline
\end{tabular}


\bigskip


\begin{tabular}{|c|c|c|c|c|}
\hline
A & 1 & \multicolumn{2}{c|}{2} & \\ \hline
B & \multicolumn{2}{c|}{2} & 1 & \\
\hline
\omit&&&&
\end{tabular}

\end{document}
